# shop_list = ['apple', 3, 'banana', 'carrot']
# 
# print 'i have', len(shop_list), "items to buy"
# print 'they are:',
# for item in shop_list:
#     print item,
# 
# print '\n'
# 
# print 'i also buy rice.'
# shop_list.append('rice')
# print 'shopping list is now', shop_list
# 
# shop_list.sort()
# print 'sorted list is:', shop_list
# 
# print 'first item is', shop_list[0]
# old_item = shop_list[0]
# del shop_list[0]
# print 'bought', old_item
# print 'list is now', shop_list

# zoo = ('monkey', 'rabbit', 'dog')
# print '# of animals in zoo', len(zoo)
# 
# new_zoo = ('wolf', 'elephant', zoo)
# print '# of animals in new zoo', len(new_zoo)
# print 'all animals in new zoo are', new_zoo
# 
# print 'brought from old zoo are', new_zoo[2]
# print 'last one brought from old zoo are', new_zoo[2][len(zoo)-1]

# dict
# ab = {
#         'yangxin' : 'dongshengyuan',
#         'xiongxong' : 'miquan',
#         'jiejie' : 'wujiaqu'
#         }
# 
# print 'yangxin\'s address is %s' %(ab['yangxin'])
# 
# ab['baba'] = 'tie chang gou'
# del ab['yangxin']
# print '%d contacts in' % len(ab),ab
# 
# for name,addr in ab.items():
#     print '%s lives at %s' % (name, addr)
# 
# if 'baba' in ab or ab.has_key('baba'):
#     print 'baba in address book:%s' % ab['baba']

# slicing
# shop_list = ['apple', 3, 'banana', 'carrot']
# 
# i = -2
# while i < len(shop_list):
#     print 'item #%d is' % i, shop_list[i]
#     i += 1
# 
# # slice 
# print '1-3 is', shop_list[1:3]
# print '2-end is', shop_list[2:]
# print '1~-1 is', shop_list[1:-1]
# print 'start-end is', shop_list[:]
# 
# name = "Republic of china"
# print '1-3 is', name[1:3]
# print '2-end is', name[2:]
# print '1~-1 is', name[1:-1]
# print 'start-end is', name[:]
 

shop_list = ['apple', 3, 'banana', 'carrot']
my_list = shop_list
my_list_2 = shop_list[:]

print shop_list, my_list, my_list_2

del shop_list[0]

print shop_list, my_list, my_list_2
